<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>注册</title>
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/css/login.css"/>
	 <script src="__PUBLIC__/Home/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>
      <script type="text/javascript" src="__PUBLIC__/Home/js/layer/layer.js" ></script>
      <script type="text/javascript" src="__PUBLIC__/Home/js/layer/tanchu.js" ></script>
      <script type="text/javascript" src="__PUBLIC__/Home/js/checkform.js" ></script>
    </head>
	<body>
		<div id="append"></div>
		<div class="full_sc">
			<div class="head_cent head_cwo ClearFix">
				<div class="h_logo">
					<a href="">
						<img src="__PUBLIC__/Home/image/logo.jpg"/>
					</a>
				</div>
				<div class="h_right">
					<img src="__PUBLIC__/Home/image/top_center.jpg"/>
				</div>
			</div>
		</div>
		<div class="w980 ClearFix">
			<div class="logo_box ClearFix">
				<div class="login_b_l ClearFix">
					<a href="" title="出发">
						<img src="__PUBLIC__/Home/image/register.jpg" alt="出发"/>
					</a>
				</div>
				<div class="login_b_r ClearFix">
					<div class="loginul ClearFix">
					    <div class="login_h2 ClearFix">
						    <h2>用户注册</h2>
						    <div class="lognrtop">
								已有账号<a href="login.html">在此登录</a>
							</div>
						</div>
					  <div class="co"> 
                        <div class="form">
                        <form id="register_form" method="post" action="">
                            <div class="item">
                                <input placeholder="请输入手机号码" class="itxt" autocomplete="off" tabindex="1" maxlength="11" name="mobile" id="mobile" type="text">
                              
                            </div>
                            <div class="item items">
                                <input placeholder="验证码" maxlength="6" tabindex="3" class="itxt itxt_yzm onfocustxt" name="mobile_code" id="mobile_code" type="text">
                               
                    		        
                    		        <span class="send_success_tips" style="display: none;" id="msgg">
                    		        <strong id="show_times" class="red mr5">60</strong>秒后再次获取</span><input type="button" name="" id="hide_times" value="获取短信验证码">
                            	
                              
                            </div>
                              <div class="item">
                                <input placeholder="请输入用户名" class="itxt" autocomplete="off" tabindex="1"  name="username" id="username" type="text">
                                <div class="err_box">
                                    
                            </div>
                            <div class="item item2">
                                <input placeholder="请输入密码" tabindex="4" maxlength="20" class="itxt" name="password" id="password" type="password">
                               
                            </div>
                            <div class="item item2">
                                <input placeholder="请再次输入密码" class="itxt" tabindex="5" maxlength="20" name="cpassword" id="cpassword" type="password">
                               
                            </div>
                            <div class="item item3">
                                <input placeholder="验证码" autocomplete="off" tabindex="6" maxlength="4" size="10" class="itxt itxt_yzm" name="chkcode" id="chkcode" type="text">
                               <img style="cursor:pointer;" onclick="this.src='<?php echo U('chkcode'); ?>#'+Math.random();" src="<?php echo U('chkcode'); ?>" />
                                
                            </div>
                            <div class="item item5">
                                <div class="login-btn">
                                    <input id="zhuce" type="button" value="立即注册" style="width:300px;height:50px;background-color:#E70012;font-size:20px;" />
                                </div>
                                <div class="agree">
                                    <input class="jdcheckbox" tabindex="8" name="must_click" id="agree" checked="checked" type="checkbox">
                                    <label for="autoLogin">注册即表示同意快乐购<span><a href="" target="_blank">《用户服务协议》</a></span>条款</label>
                                </div>
                            </div>
                        </form>
                        </div>
					   </div>
					</div>
				</div>
			</div>
		</div>
	</body>
<script>
$("#zhuce").click(function(){
   var data = $("#register_form").serializeArray();
   if (!checkform()) {
        return false;
   }
 
   $.post('{{:U('Home/Member/regist')}}',data,function(res){
        if (res.status==1) {
            tanchu.success(res.message,'{{:U('Home/Member/login')}}');
        }else if(res.status==0){
            tanchu.error(res.message);
        }
   },'JSON');

});
var timer;
$("#hide_times").click(function(){
    var mobile=$("#mobile").val();
    if (!(/^1[34578]\d{9}$/.test(mobile))) {
        tanchu.error('请先输入正确的手机号');
        return false;
    }
    var data={
        'mobile':mobile,
    }
    $.post('{{:U('Home/Member/msg')}}',data,function(res){
        if(res.status==1){
            $("#hide_times").hide();
            $("#msgg").show();
            var i=60;
            timer=setInterval(function (){
                i--;
                $("#msgg").attr("disabled", true);
                 $("#show_times").text(i);
                 if (i==0) {
                    clearInterval(timer);
                    $("#msgg").removeAttr("disabled");
                    $("#hide_times").show();
                    $("#msgg").hide();
                 }
            },1000);
        }else if(res.status==0){
            $("#hide_times").val('发送失败请重新发送');
        }
       
    },'JSON');
});
$("#mobile_code").blur(function(){
    var code = $(this).val();
    var data={
            'sjyz':code,
    }
     $.get('{{:U('Home/Member/sjyz')}}',data,function(res){
        if(res.status==1){
            $("#msgg").hide();
            $("#hide_times").show();
              $("#hide_times").val(res.message);
              clearInterval(timer);
        }else{
              $("#msgg").hide();
            $("#hide_times").show();
            $("#hide_times").val(res.message);
            clearInterval(timer);
        }
       
    },'JSON');

});

</script>

</html>
